import apibase from "@/api/apiBase";
import axios from "axios";
import { planEditAttr, planList, planStopSale, productAdd, productDel, productEdit } from "./productList.interface";

//获取产品列表
export const $productGetList = () => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.get({
    url: '/travel/product/getList',
    data: {},
    instance,
  });
}
//新增产品
export const $productAdd = (params: productAdd) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.post({
    url: '/travel/product/add',
    data: params,
    instance,
  })
}
//编辑产品
export const $productEidt = (params: productEdit) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.post({
    url: '/travel/product/edit',
    data: params,
    instance,
  })
}
//删除产品
export const $productDel = (params: productDel) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.post({
    url: '/travel/product/del',
    data: params,
    instance,
  })
}

//产品计划列表
export const $getPlanList = (params: planList) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.get({
    url: '/travel/plan/getList',
    data: params,
    instance,
  });
}

//编辑产品计划属性
export const $planEditAttr = (params: planEditAttr) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.post({
    url: '/travel/plan/editAttr',
    data: params,
    instance,
  })
}

//产品计划停售
export const $planStopSale = (params: planStopSale) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.post({
    url: '/travel/plan/stopSale',
    data: params,
    instance,
  })
}

//产品计划开售
export const $planSale = (params: planStopSale) => {
  const $server = new apibase();
  const instance = axios.create();
  return $server.post({
    url: '/travel/plan/sale',
    data: params,
    instance,
  })
}
